#include "GUICamera.h"
#include "GUINest.h"
#include "Part.h"

GUICamera::GUICamera(int startX, int startY, QGraphicsScene *scene)
	:GUIBase() //constructor
{
	loadImage("Resources/Sprites/Camera.png");

	this->setX(startX);
	this->setY(startY);
	this->setZValue(ZVALUE_CAMERA);

	this->hide(); //hide the graphic
	//takePicture();
}

GUICamera::~GUICamera() //deconstructor
{

}

void GUICamera::takePicture() //function that takes picture
{
	waitingFrame = 0;
	this->show(); //shows picture
}

void GUICamera::advance(int phase) //override the advance function
{
	if(phase==1)
	{
		{
			if(waitingFrame >= 10) //picture has stayed active long enough, so hide picture
			{
				this->hide(); //hide picture
				waitingFrame = -1; //set to -1 so the picture doesn't show
			}
			else if(waitingFrame >= 0) //keep picture shown
			{
				waitingFrame += 1; 
			}
		}
	}
}

void GUICamera::DoBreak()
{
	GUIBase::DoBreak();
	this->show();
}

void GUICamera::DoFix()
{
	GUIBase::DoFix();
	this->hide();
}